﻿namespace Pogo.Data
{
   public abstract class PogoObject
   {
      internal virtual PogoObject Parent { get; set; }

      internal Plug Root
      {
         get
         {
            PogoObject result = this;
            while (result.Parent != null) result = result.Parent;
            return (Plug) result;
         }
      }

      protected virtual string AuthToken
      {
         get { return Parent.AuthToken; }
         set { }
      }

      public virtual bool LoggedIn
      {
         get { return !string.IsNullOrEmpty(AuthToken); }
      }
   }
}